<template>
  <section class="box">
    <handle-info :callback="getData" :type='1'></handle-info>
  </section>
</template>
<script>
  import {studentCreat} from 'api/school/student/index'
  import handleInfo from 'components/student/handleInfo'
  export default {
    data () {
      return {
        form: {}
      }
    },
    components: {
      handleInfo
    },
    methods: {
      getData (data, index, form) {
        if (index === 1) {
          studentCreat(data).then(v => {
            if (v.errcode !== '0') {
              this.$message({
                showClose: true,
                message: v.errmsg,
                type: 'error',
                duration: 2000
              })
            }
          })
        } else if (index === 2) {
          studentCreat(data).then(v => {
            if (v.errcode === '0') {
              this.$router.push({name: 'studentManage'})
            }
          })
        }
      },
      conso () {
        console.log(this.form, 8888888885555555)
      }
    }
  }
</script>